package org.joseph.springcloud.controller;

import org.joseph.springcloud.pojo.User;
import org.joseph.springcloud.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/user/add")
    public boolean insertUser(User user){
        return userService.insertUser(user);
    }

    @GetMapping("/user/queryById/{id}")
    public User queryById(@PathVariable("id") long id){
        System.out.println("this is 8001");
        return userService.queryById(id);
    }
}

